Baby step toward host SMP support
authordjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>
Tue, 30 Aug 2005 23:51:51 +0000 (17:51 -0600)
committerdjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>
Tue, 30 Aug 2005 23:51:51 +0000 (17:51 -0600)
xen/arch/ia64/linux-xen/mm_contig.c
xen/arch/ia64/linux-xen/smp.c
xen/arch/ia64/linux-xen/smpboot.c
xen/arch/ia64/vcpu.c
xen/arch/ia64/xenmisc.c
xen/arch/ia64/xensetup.c

index 87ab66deca25f15925a79df03c09608cc2768a88..f3a3b39a48e4d8715a239bb766022ba05878a51f 100644 (file)
@@ -192,8 +192,8 @@ per_cpu_init (void)
         */
        if (smp_processor_id() == 0) {
 #ifdef XEN
-               cpu_data = alloc_xenheap_pages(PERCPU_PAGE_SIZE -
-                       PAGE_SIZE + get_order(NR_CPUS));
+               cpu_data = alloc_xenheap_pages(PERCPU_PAGE_SHIFT -
+                       PAGE_SHIFT + get_order(NR_CPUS));
 #else
                cpu_data = __alloc_bootmem(PERCPU_PAGE_SIZE * NR_CPUS,
                                           PERCPU_PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
index 872ea4b025d9a9522343fe6d4db5c4337a20452d..28c294a24702cd73f84cd41346ba00d3027930e3 100644 (file)
@@ -63,7 +63,8 @@ void flush_tlb_mask(cpumask_t mask)
 //Huh? This seems to be used on ia64 even if !CONFIG_SMP
 void smp_send_event_check_mask(cpumask_t mask)
 {
-       dummy();
+       printf("smp_send_event_check_mask called\n");
+       //dummy();
        //send_IPI_mask(cpu_mask, EVENT_CHECK_VECTOR);
 }
 
@@ -378,7 +379,11 @@ smp_call_function (void (*func) (void *info), void *info, int nonatomic, int wai
 
        /* Can deadlock when called with interrupts disabled */
 #ifdef XEN
-       if (irqs_disabled()) panic("smp_call_function called with interrupts disabled\n");
+       if (irqs_disabled()) {
+               printk("smp_call_function called with interrupts disabled...");
+               printk("enabling interrupts\n");
+               local_irq_enable();
+       }
 #else
        WARN_ON(irqs_disabled());
 #endif
@@ -390,11 +395,15 @@ smp_call_function (void (*func) (void *info), void *info, int nonatomic, int wai
        if (wait)
                atomic_set(&data.finished, 0);
 
+       printk("smp_call_function: about to spin_lock \n");
        spin_lock(&call_lock);
+       printk("smp_call_function: done with spin_lock \n");
 
        call_data = &data;
        mb();   /* ensure store to call_data precedes setting of IPI_CALL_FUNC */
+       printk("smp_call_function: about to send_IPI \n");
        send_IPI_allbutself(IPI_CALL_FUNC);
+       printk("smp_call_function: done with send_IPI \n");
 
        /* Wait for response */
        while (atomic_read(&data.started) != cpus)
@@ -405,7 +414,9 @@ smp_call_function (void (*func) (void *info), void *info, int nonatomic, int wai
                        cpu_relax();
        call_data = NULL;
 
+       printk("smp_call_function: about to spin_unlock \n");
        spin_unlock(&call_lock);
+       printk("smp_call_function: DONE WITH spin_unlock, returning \n");
        return 0;
 }
 EXPORT_SYMBOL(smp_call_function);
index 92c9dec16181d39ab3d9d0030370eb0d1e9fdc95..1c0e84e31d370a4822ab175d95e92c325c54500d 100644 (file)
@@ -68,7 +68,8 @@ int ht_per_core = 1;
 
 #ifdef CONFIG_SMP /* ifdef XEN */
 
-#define SMP_DEBUG 0
+//#define SMP_DEBUG 0
+#define SMP_DEBUG 1
 
 #if SMP_DEBUG
 #define Dprintk(x...)  printk(x)
index b1cd4dea602009968b13facfa901cd90db5fdd0f..55af8a49e493c612bca22b3e4df1dcc73b2364f6 100644 (file)
@@ -586,6 +586,7 @@ void vcpu_pend_interrupt(VCPU *vcpu, UINT64 vector)
        PSCB(vcpu,pending_interruption) = 1;
     }
 
+#if 0
     /* Keir: I think you should unblock when an interrupt is pending. */
     {
         int running = test_bit(_VCPUF_running, &vcpu->vcpu_flags);
@@ -593,6 +594,7 @@ void vcpu_pend_interrupt(VCPU *vcpu, UINT64 vector)
         if ( running )
             smp_send_event_check_cpu(vcpu->processor);
     }
+#endif
 }
 
 void early_tick(VCPU *vcpu)
index c76a93eca8a8d538377316555a145064609c86ac..701614130e798970baff83e59f72a45d862da34b 100644 (file)
@@ -28,7 +28,12 @@ void ia64_mca_init(void) { printf("ia64_mca_init() skipped (Machine check abort
 void ia64_mca_cpu_init(void *x) { }
 void ia64_patch_mckinley_e9(unsigned long a, unsigned long b) { }
 void ia64_patch_vtop(unsigned long a, unsigned long b) { }
-void hpsim_setup(char **x) { }
+void hpsim_setup(char **x)
+{
+#ifdef CONFIG_SMP
+       init_smp_config();
+#endif
+}
 
 // called from mem_init... don't think s/w I/O tlb is needed in Xen
 //void swiotlb_init(void) { }  ...looks like it IS needed
index bef39ead8ede4f9dd2c3b934dfc8ec0b30a7d609..182f6ce874c1c6155634680ac7b7ccf838d72ebd 100644 (file)
@@ -260,6 +260,41 @@ printk("About to call xen_time_init()\n");
 printk("About to call ac_timer_init()\n");
     ac_timer_init();
 // init_xen_time(); ???
+
+#ifdef CONFIG_SMP
+    if ( opt_nosmp )
+    {
+        max_cpus = 0;
+        smp_num_siblings = 1;
+        //boot_cpu_data.x86_num_cores = 1;
+    }
+
+    smp_prepare_cpus(max_cpus);
+
+    /* We aren't hotplug-capable yet. */
+    //BUG_ON(!cpus_empty(cpu_present_map));
+    for_each_cpu ( i )
+        cpu_set(i, cpu_present_map);
+
+    //BUG_ON(!local_irq_is_enabled());
+
+printk("num_online_cpus=%d, max_cpus=%d\n",num_online_cpus(),max_cpus);
+    for_each_present_cpu ( i )
+    {
+        if ( num_online_cpus() >= max_cpus )
+            break;
+        if ( !cpu_online(i) ) {
+printk("About to call __cpu_up(%d)\n",i);
+            __cpu_up(i);
+       }
+    }
+
+    printk("Brought up %ld CPUs\n", (long)num_online_cpus());
+    smp_cpus_done(max_cpus);
+#endif
+
+
+       // FIXME: Should the following be swapped and moved later?
     schedulers_start();
     do_initcalls();
 printk("About to call sort_main_extable()\n");